package com.logisticsmanagement.utils;

import java.io.BufferedReader;
import java.io.IOException;

import javax.servlet.http.HttpServletRequest;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class JsonUtls {

	public static JSONObject JSONObject(HttpServletRequest req) throws IOException{
		BufferedReader br = req.getReader();
		String jsonReq = "";
		while(true){
			String temp = br.readLine();
			if(temp == null)
				break;
			jsonReq += temp;
		}
		JSONObject ret = null;
		try{
			ret = JSONObject.fromObject(jsonReq);;
		}catch(Exception e){
			ret = new JSONObject();
		}
		return ret;
	}
}
